
<template>
  <div class="menu-list">
    <div class="menu-item" v-for="(v,i) in  category" :key="v.maitKey" :class="[curIdx===i ? 'active' :'']" @click="selectItem(i)">
      {{v.title}}
    </div>
  </div>
</template>

<script>
export default {
  props: {
    category: {
      type: Array,
      default() {
        return []
      }
    }
  },
  data() {
    return {
      curIdx: 0
    }
  },
  methods: {
    selectItem(i) {
      this.curIdx = i
      this.$emit('selectItem', i)
    }
  }
}
</script>

<style scoped>
.menu-list {
  width: 100px;
  background-color: #f6f6f6;
  text-align: center;
}
.menu-item {
  line-height: 49px;
}
.active {
  border-left: 3px solid var(--color-tint);
  background-color: #fff;
  color: var(--color-tint);
}
</style>
